package repository.beans;

import javax.ejb.Stateless;

import model.Department;
import model.Position;
import repository.DepartmentRepository;
import repository.exceptions.RepositoryException;
@Stateless(name="DepartmentRepository", mappedName="ejb/DepartmentRepository")
public class DepartmentRepositoryBean extends BaseRepositoryBean<Department,Long> implements DepartmentRepository {

	public DepartmentRepositoryBean() {
		super(Department.class);
		
	}

	@Override
	public Department getDepartmentByName(String department)
			throws RepositoryException {
		for(Department d:this.getAll()){
			if(d.getName().equals(department)){
				return d;
			}
		}
		return null;
	}

}
